package net.chenlin.dp.modules.sys.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import net.chenlin.dp.modules.sys.entity.SysUserEntity;
import net.chenlin.dp.modules.sys.entity.SysUserLinkerEntity;
import net.chenlin.dp.modules.sys.dao.SysUserLinkerMapper;
import net.chenlin.dp.modules.sys.service.SysUserLinkerService;

/**
 * 系统用户
 * @author ZhouChenglin<yczclcn@163.com>
 */
@Service("sysUserLinkerService")
public class SysUserLinkerServiceImpl implements SysUserLinkerService {

	@Autowired
    private SysUserLinkerMapper sysUserLinkerMapper;

    /**
     * 分页查询
     * @param params
     * @return
     */
	@Override
	public Page<SysUserLinkerEntity> listSysUserLinker(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysUserLinkerEntity> page = new Page<>(query);
		sysUserLinkerMapper.listForPage(page, query);
		return page;
	}

    /**
     * 新增
     * @param sysUserLinker
     * @return
     */
	@Override
	public R saveSysUserLinker(SysUserLinkerEntity sysUserLinker) {
		int count = sysUserLinkerMapper.save(sysUserLinker);
		return CommonUtils.msg(count);
	}

    /**
     * 根据id查询
     * @param id
     * @return
     */
	@Override
	public R getSysUserLinkerById(Long id) {
		SysUserLinkerEntity sysUserLinker = sysUserLinkerMapper.getObjectById(id);
		return CommonUtils.msg(sysUserLinker);
	}

    /**
     * 修改
     * @param sysUserLinker
     * @return
     */
	@Override
	public R updateSysUserLinker(SysUserLinkerEntity sysUserLinker) {
		int count = sysUserLinkerMapper.update(sysUserLinker);
		return CommonUtils.msg(count);
	}

    /**
     * 删除
     * @param id
     * @return
     */
	@Override
	public R batchRemove(Long[] id) {
		int count = sysUserLinkerMapper.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

	@Override
	public SysUserEntity getByLinkerUser(String linktype, String linkUserId) {
		// TODO Auto-generated method stub
		return null;
	}

}
